#include <iostream>
#include <cstring>
#define MAC_ADDRESS_LENGTH 6

typedef unsigned char MAC_address[MAC_ADDRESS_LENGTH];

struct EthernetFrame 
{
    MAC_address destination_address;  
    MAC_address source_address;       
    unsigned short ether_type;     
    unsigned char payload[1500];
};

MAC_address this_mac_address = {0x00, 0x1A, 0x2B, 0x3C, 0x4D, 0x5E};

int mac_address_match(const struct EthernetFrame *frame) 
{
    bool is_broadcast = true;
    for (int i = 0; i < MAC_ADDRESS_LENGTH; ++i) 
    {
        if (frame->destination_address[i] != 0xFF) 
        {
            is_broadcast = false;
            break;
        }
    }
    if (is_broadcast) 
    {
        return 1;
    }
    if (frame->destination_address[0] & 0x01) 
    {
        return 1;
    }
    if (memcmp(frame->destination_address, this_mac_address, MAC_ADDRESS_LENGTH) == 0) 
    {
        return 1;
    }
    return 0;
}

int main() 
{
    EthernetFrame frame;
    memset(frame.destination_address, 0xFF, MAC_ADDRESS_LENGTH);
    MAC_address source_address = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
    memcpy(frame.source_address, source_address, MAC_ADDRESS_LENGTH);
    frame.ether_type = 0x0800;
    if (mac_address_match(&frame)) 
    {
        std::cout << "Frame should be accepted." << std::endl;
    } 
    else 
    {
        std::cout << "Frame should be rejected." << std::endl;
    }

    return 0;
}